package com.andong.service.impl;

import com.andong.domain.pojo.Result;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.andong.domain.entity.SubjectProgress;
import com.andong.service.SubjectProgressService;
import com.andong.mapper.SubjectProgressMapper;
import org.springframework.stereotype.Service;

/**
* @author 王海云
* @description 针对表【subject_progress(题库进度表)】的数据库操作Service实现
* @createDate 2024-01-16 19:05:47
*/
@Service
public class SubjectProgressServiceImpl extends ServiceImpl<SubjectProgressMapper, SubjectProgress>
    implements SubjectProgressService{

    @Override
    public Result addOrUpdate(SubjectProgress subjectProgress) {
        saveOrUpdate(subjectProgress);
        return Result.success(subjectProgress);
    }

    @Override
    public Result getProgress(Long id, Integer type) {
        SubjectProgress progress = lambdaQuery()
                .eq(SubjectProgress::getStudentId, id)
                .eq(SubjectProgress::getType, type)
                .one();
        return Result.success(progress);
    }
}




